﻿using System.Globalization;
using System.Windows.Controls;
using System.Windows.Markup;

namespace MvvmValidationDemo.ValidationRules
{
    public class RequiredRule:ValidationRule
    {
        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            if (value == null || string.IsNullOrEmpty(value.ToString()))
            {
                return new ValidationResult(false, "不能为空！");
            }

            return new ValidationResult(true, null);
        }
    }
}